
from base.api.weather_forecast import WeatherForecast
from config import BaseDir
from uitls.bulid_data import bulid_data

class weather_forecast_page():

    def __init__(self):
        self.weather_base = WeatherForecast()
        self.bulid_data = bulid_data()
        self.fileName = BaseDir+"/data/data_weather.xml"

    def weather_forecaast_page(self,data):
        url = self.bulid_data.read_xml(self.fileName,"weather","url")
        result = self.weather_base.weather_forecast(url,data)
        return result


if __name__ == '__main__':
    data = {'city': '深圳', 'key': 'f19ce33c1de05b6e6b9a37d3c1dba0bf'}
    aa = weather_forecast_page()
    result = aa.weather_forecaast_page(data)
    print(result.json())